<?php

Raise::load('core.io.RaiseStream');

/**
 * TestCoreRaiseStream class
 * Testing unit of 'phpraise/core/RaiseStream.php'
 *
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestCoreRaiseStream extends RaiseTest {

    public static function testStream(){

        self::assertClassExists('RaiseStream');
        self::assertClassIsAbstract('RaiseStream');
        self::assertClassExists('MockRaiseStream');
        self::assertClassExtends('RaiseStream', 'RaiseObject');
        self::assertClassExists('MockRaiseStream', 'RaiseStream');

        self::assertClassMethod('RaiseStream', 'length');
        self::assertClassMethod('RaiseStream', 'position');

        $streamA = new MockRaiseStream('testingBuffer');
        self::assertObjectClass($streamA, 'MockRaiseStream');
        $streamB = new MockRaiseStream('testingphpRaiseBuffer');
        self::assertObjectClass($streamB, 'MockRaiseStream');

        /* Testing Stream Copying */

        $streamA->copy($streamB);

        $streamA->seek(0);
        $streamB->seek(0);
        self::assertStrictEqual($streamB->read($streamA->length()), $streamA->read($streamA->length()));
        
    }

}

